﻿using UnityEngine;

public class SkeletonStunState:SkeletonStateBase
{
    public SkeletonStunState(ControllerBase controller, StateMachineBase stateMachine, 
        string stateName, string animatorParameter = null) : base(controller, stateMachine, stateName, animatorParameter)
    {
    }

    public override void Enter()
    {
        base.Enter();
        SelfController.flashFX.TriggerStun();
        //给一个反方向的力
        SelfController.mRigidbody2D.AddForce(new Vector2(-SelfController.faceDir,1)*8f, ForceMode2D.Impulse);
    }

    public override void Exit()
    {
        base.Exit();
        SelfController.flashFX.StopStun();
    }

    public override void Update()
    {
        base.Update();
        if (stateDuration>0.35f)
        {
            stateMachine.ChangeState(Setting.idle);
            return;
        }
    }
}